package com.aisi.commonService.exception;

import com.aisi.model.vo.common.Result;
import com.aisi.model.vo.common.ResultCodeEnum;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @Author: shenjianZ
 * @Date: 2024/2/16 20:49
 * @Description: 全局异常处理器
 */

@ControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler(AiSiException.class)
    @ResponseBody
    public Result error(AiSiException e){
        return Result.build(null, e.getResultCodeEnum());
    }
}
